package com.stox.client.ui.javafx.chartingy.widget.toolbar;

import javafx.collections.FXCollections;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;

import com.stox.client.ui.javafx.chartingy.model.enumeration.BarType;
import com.stox.client.ui.javafx.chartingy.view.ChartingView;
import com.stox.client.ui.javafx.core.util.CSS;
import com.stox.client.ui.javafx.core.util.UI;
import com.stox.shared.core.model.enumeration.BarSpan;
import com.stox.shared.core.model.enumeration.Span;

public class BasicTools extends HBox {

	private final ComboBox<Span> spanComboBox = new ComboBox<Span>(FXCollections.observableArrayList(Span.values()));
	private final ComboBox<BarType> barTypeComboBox = new ComboBox<BarType>(FXCollections.observableArrayList(BarType.values()));
	private final ComboBox<BarSpan> barSpanComboBox = new ComboBox<BarSpan>(FXCollections.observableArrayList(BarSpan.values()));

	public BasicTools(final ChartingView chartingView) {
		UI.style(this, CSS.chartingToolsContainer);

		final Region spacer = new Region();
		HBox.setHgrow(spacer, Priority.ALWAYS);
		getChildren().addAll(spanComboBox, barTypeComboBox, barSpanComboBox, spacer);

		spanComboBox.valueProperty().bindBidirectional(chartingView.spanProperty());
		barTypeComboBox.valueProperty().bindBidirectional(chartingView.barTypeProperty());
		barSpanComboBox.valueProperty().bindBidirectional(chartingView.barSpanProperty());
	}

}
